package com.educhains.module.activity.persist.dao.impl;


import com.educhains.module.activity.persist.dao.ActivityDAO;
import com.educhains.module.activity.persist.mybatis.ActivityJoinMapper;
import com.educhains.module.activity.persist.mybatis.ActivityMapper;
import com.educhains.module.activity.vo.mb_model.Activity;
import com.educhains.module.activity.vo.mb_model.ActivityJoin;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class ActivityDAOImpl implements ActivityDAO{

    @Autowired
    private ActivityMapper activityMapper;

    @Autowired
    private ActivityJoinMapper activityJoinMapper;

    public Activity selectByPrimaryKey(String activityId) {
        return activityMapper.selectByPrimaryKey(activityId);
    }

    public int insertSelective(Activity record) {
        return activityMapper.insertSelective(record);
    }


    public List<Activity> selectActivityList() {
        return activityMapper.selectActivityList();
    }

    public List<Activity> showByPage(int start, int end) {
        return activityMapper.showByPage(start, end);
    }

    public List<Activity> selectActivityListLimit(@Param("activityNum") int activityNum, @Param("type") String type) {
        return activityMapper.selectActivityListLimit(activityNum, type);
    }

    public List<ActivityJoin> selecetActivityJoinListLimitByAID(String activityId, int num) {
        return activityJoinMapper.selecetActivityJoinListLimitByAID(activityId);
    }

    public List<ActivityJoin> selecetActivityJoinListLimitByUID(String userId, int num) {
        return activityJoinMapper.selecetActivityJoinListLimitByUID(userId, num);
    }

    public int insertActivityJoin(ActivityJoin record) {
        return activityJoinMapper.insertActivityJoin(record);
    }

    public List<Activity> getActivityListByUserIdWithLimit(String userId, int limit) {
        return activityMapper.getActivityListByUserIdWithLimit(userId, limit);
    }
}
